package mis.module.base.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "Product")
@DynamicInsert(true)
@DynamicUpdate(true)
public class Product implements java.io.Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 7033536741537810874L;
	private int id;
	private String productNo;
	private String productName;
	private String description;
	private double price;
	private ProductType productType;

	@Id
	@Column(name = "ID", unique = true, nullable = false, length = 11)
	@GeneratedValue(generator = "generator") 
	@GenericGenerator(name = "generator", strategy = "identity") 	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	@Column(name = "productNo",unique = true, nullable = false, length = 36)
	public String getProductNo() {
		return productNo;
	}
	public void setProductNo(String productNo) {
		this.productNo = productNo;
	}
	@Column(name="productName",length = 36,nullable = false)
	public String getProductName() {
		return productName;
	}
	public void setProductName(String productName) {
		this.productName = productName;
	}
	@Column(name="description",length = 100)
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	@Column(name="price")
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "productTypeId")
	public ProductType getProductType() {
		return productType;
	}
	public void setProductType(ProductType productType) {
		this.productType = productType;
	}
	
}
